// $codepro.audit.disable
/*
 * Records Package
 */
package edu.gatech.oad.records;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import edu.gatech.oad.schedule.Appointment;

import junit.framework.TestCase;

/**
 * JUnit test for the TreatmentRecord Class
 * @author Nathan Hurley
 * @version 1.0
 */
public class TreatmentRecordTest extends TestCase {
	/**
	 * List of reasons
	 */
	private final List<String> testList = new ArrayList<String>();
	
	/**
	 * Test addition of a TreatmentRecord to the patients history
	 */
	public void testAddTreatmentRecord(){
		final PatientHistory curHistory = new PatientHistory();
		testList.add("Test Appointment");
		final Appointment curAppointment = new Appointment(new Date(), testList);
		final TreatmentRecord curRecord = new TreatmentRecord(curAppointment);
		curHistory.addTreatmentRecord(curRecord);
		assertEquals(1, curHistory.getTreatmentRecords().size()); //check size is correct
	}
	
	/**
	 * Tests editing a TreatmentRecord
	 */
	public void testEditTreatmentRecord()
	{
		testList.add("Test Appointment");
		Appointment curAppointment = new Appointment(new Date(), testList);
		TreatmentRecord curRecord = new TreatmentRecord(curAppointment);
		curRecord.setHeight("77.3");
		assertEquals(77.3, curRecord.getHeight());
		curRecord.setHeight("79");
		assertEquals(79.0, curRecord.getHeight());//check that new value is updated for height field
	}
	
	/**
	 * Tests the removal of a TreatmentRecord
	 */
	public void testDeleteTreatmentRecord()
	{
		PatientHistory curHistory = new PatientHistory();
		testList.add("Test Appointment");
		Appointment curAppointment = new Appointment(new Date(), testList);
		TreatmentRecord firstRecord = new TreatmentRecord(curAppointment);
		TreatmentRecord secondRecord = new TreatmentRecord(curAppointment);
		curHistory.addTreatmentRecord(firstRecord);
		curHistory.addTreatmentRecord(secondRecord);
		curHistory.removeTreatmentRecord(secondRecord);
		assertEquals(1, curHistory.getTreatmentRecords().size());//check size of list is updated
		assertEquals(firstRecord, curHistory.getTreatmentRecords().get(0)); //check that the firstRecord is still present
	}
	
}
